<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>分类</title>
    <link rel="stylesheet" type="text/css" href="../css/aui.2.0.css" />
</head>
<body>
    <div class="aui-content aui-margin-t-5" id="app">
        <section class="aui-grid aui-margin-b-15">
            <div class="aui-row">
                <div class="aui-col-xs-4" @click="open_cate_list_win(index)" v-for="(vo,index) in list">
                    <div class="aui-grid-label">{{ vo.title }}</div>
                </div>
            </div>
        </section>
    </div>
</body>
</html>
<script src="../script/api.js"></script>
<script src="../script/common.js"></script>
<script src="../script/vue.js"></script>
<script>

    var vm = new Vue({
        el: '#app',
        data: {
            list: [],
        },
        methods: {
            init: function () {
                api.ajax({
                    url: cate_list_url,
                    method: 'post',
                    timeout: 30,
                    dataType: 'json',
                    returnAll: false,
                    data: {
                        values: {
                            name: 'values'
                        }
                    }
                }, function (ret, err) {
                    if (ret) {
                        vm.list = [],
                        vm.list = ret.data;
                        console.log(JSON.stringify(ret));
                    } else {
                        console.log(JSON.stringify(err));
                    }
                });
            },
            open_cate_list_win:function (index) {
                var pid = vm.list[index].id;
                var title = vm.list[index].title;
                api.openWin({
                    name: 'cate_list_win',
                    url: 'widget://html/cate_list_win.html',
                    pageParam: {
                        pid: pid,
                        title: title
                    }
                });
            }
        }
    });
    apiready = function () {
        vm.init();
        api.setRefreshHeaderInfo({
            visible: true,
            loadingImg: 'widget://image/refresh.png',
            bgColor: '#ccc',
            textColor: '#fff',
            textDown: '下拉刷新...',
            textUp: '松开刷新...',
            showTime: true
        }, function (ret, err) {

            vm.init();
            setTimeout("api.refreshHeaderLoadDone()", '500');
        });
    };
</script>
